<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:p="http://primefaces.org/ui">
  <h:head>
  </h:head>

  <h:body>
    <ui:composition template="/dataverse_template.xhtml">
      <ui:param name="pageTitle" value="Role/Permission Relationships - #{dataverseServiceBean.findRootDataverse().name}"/>
      <ui:param name="showDataverseHeader" value="false"/>
      <ui:define name="metadata">
          <f:metadata>
                <ui:remove>
                    <f:viewParam name="id" value="#{DatasetPage.dataset.id}"/>
                    <f:viewParam name="ownerId" value="#{DatasetPage.ownerId}"/>
                    <f:viewParam name="version" value="#{DatasetPage.version}"/>
                    <f:viewParam name="versionId" value="#{DatasetPage.versionId}"/>
                    <f:viewParam name="persistentId" value="#{DatasetPage.persistentId}"/>
                </ui:remove>
                <f:viewAction action="#{dataverseSession.updateLocaleInViewRoot}"/>
                <f:viewAction action="#{RolePermissionHelperPage.init}" />
          </f:metadata>
      </ui:define>
      <ui:define name="body">
          <div>
        
              <h4>Related roles for each DvObject type</h4>
    <table class="table table-bordered table-condensed text-center">


<!-- start: Iterate through a list of lists -->        
<ui:repeat value="#{RolePermissionHelperPage.rolePermissionHelper.rolesByDvObjectTable}" var="singleRow">
    <tr>
    <ui:repeat value="#{singleRow}" var="dvValue">
        <td>        
         <ui:fragment rendered="#{dvValue == 'YES'}">
             <span class="label label-success">Yes</span>
         </ui:fragment>
         <ui:fragment rendered="#{dvValue != 'YES'}">
              <h:outputText value="#{dvValue}" escape="false" />
         </ui:fragment>
        </td>
    </ui:repeat>
    </tr>
</ui:repeat>
<!-- end: Iterate through a list of lists -->   
    </table>
                        
             <h4>roles with dataverse permissions</h4>
            <p>
                <h:outputText value="#{RolePermissionHelperPage.rolePermissionHelper.getRolesWithDataversePermissionsAsHTML()}" escape="false" /> 
             </p>
                  

                 <h4>roles with dataset permissions</h4>
             <p>                 
                <h:outputText value="#{RolePermissionHelperPage.rolePermissionHelper.getDatasetRolesAsHTML()}" escape="false" /> 
             </p>
              
                 <h4>roles with file permissions</h4>
            <p>
                 
                <h:outputText value="#{RolePermissionHelperPage.rolePermissionHelper.getRolesWithFilePermissionsAsHTML()}" escape="false" /> 

             </p><ui:remove> 
            <ui:repeat value="#{RolePermissionHelperPage.rolePermissionHelper.rolesWithDataversePermissions}" var="info">
   <li> 
        <h:inputText value="#{info.getKey()}" />
        <h:inputText value="#{info.getValue()}" />
   </li> 
  </ui:repeat>     
             <hr />
             <hr />
            <h:outputText value="#{RolePermissionHelperPage.getRoleInfo()}" escape="false" /> 

                        <hr />
            <h:outputText value="#{RolePermissionHelperPage.rolePermissionHelper.roleNameListString}" escape="false" /> 
            <hr />

             <h:outputText value="#{RolePermissionHelperPage.rolePermissionHelper.rolesWithDataversePermissions}" escape="false" /> 
</ui:remove>
             
          </div>
      </ui:define>
    </ui:composition>
  </h:body>
</html>
